local quege = fk.CreateSkill {
  name = "th_quege",
}

quege:addEffect(fk.EventPhaseProceeding, {
  anim_type = "defensive",
  can_trigger = function(self, event, target, player, data)
    if player:hasSkill(quege.name) and not target.dead and player:inMyAttackRange(target) then
      return target.phase == Player.Start and target:getMark("@@th_quege-turn") == 0
    end
  end,
  on_cost = function(self, event, target, player, data)
    local card = player.room:askToDiscard(player, {
      min_num = 1,
      max_num = 1,
      include_equip = true,
      skill_name = quege.name,
      cancelable = true,
      prompt = "#th_quege-invoke::"..target.id,
      skip = true
    })
    if #card == 1 then
      event:setCostData(self, { cards = card })
      return true
    end
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local dat = event:getCostData(self)
    room:throwCard(dat.cards, quege.name, player, player)
    player.room:setPlayerMark(target, "@@th_quege-turn", 1)
  end,
})

quege:addEffect("prohibit", {
  name = "#th_quege_prohibit",
  is_prohibited = function(self, from, to, card)
    if from and from:getMark("@@th_quege-turn") == 1 then
      return from:compareDistance(to, 1, ">")
    end
  end
})

Fk:loadTranslationTable{
  ["th_quege"] = "雀歌",
  [":th_quege"] = "你攻击范围内角色的准备阶段，你可以弃置一张牌，令其本回合内不能指定其距离大于1的角色为目标。",

  ["#th_quege-invoke"] = "雀歌：你可以令 %dest 本回合内不能指定其距离大于1的角色为目标",

  ["@@th_quege-turn"] = "雀歌",
}

return quege